package com.miyu.book;

import com.miyu.book.utils.baseDao.MiyuRepositoryFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.EnableTransactionManagement;

//启动自管理jpa 管理处理 两种方式 1 启动类 2，dao调用时
@EnableJpaRepositories(repositoryFactoryBeanClass = MiyuRepositoryFactoryBean.class)
@SpringBootApplication
@EnableEurekaClient
@Component
@EnableTransactionManagement
@EnableFeignClients
public class BookApplication extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(BookApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(BookApplication.class, args);
    }

}
